﻿using ManYan.Common.DomainInterface;
using ManYan.Domain.Model.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ManYan.EFCore
{
    public class WechatDbContext : DbContext, IWechatDbContext
    {
        private IConfiguration _configuration;
        public WechatDbContext(IConfiguration configuration)
        {
            _configuration = configuration;
        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            var conn = _configuration.GetConnectionString("wechatConnectionStr");
            if (conn == null)
                conn = "Data Source=0.0.0.1;Database=dotnet123;User ID=root;Password=Cmkndl307!@#;pooling=true;port=3306;sslmode=none;CharSet=utf8;";
            optionsBuilder.UseMySql(conn, ServerVersion.AutoDetect(conn));
        }
        public DbSet<WechatUser>? wechatUsers { get; set; }

        public DbSet<Users>? users { get; set; }

        public DbSet<tb_system_nav>? tb_System_Navs { get; set; }

        public DbSet<tb_exam_content>? tb_exam_content { get; set; }

        public DbSet<tb_user_refresh_token>? tb_user_refresh_token { get; set; }

        public DbSet<tb_exam_Professional_English>? tb_exam_Professional_English { get; set; }
    }
}
